<template>
  <LayoutWrap :isExpand="isExpand" class="flex flex-1">
    <template #left v-if="!isExpand"> <Left></Left></template>
    <template #centerTop>
      <CenterTop :style="centerTopStyle" v-if="active == 2"></CenterTop>
      <customMap v-else :style="centerTopStyle"></customMap>
    </template>
    <template #centerBottom v-if="!isExpand"></template>
    <template #right v-if="!isExpand"><Right></Right></template>
  </LayoutWrap>
</template>
<route lang="json">
{
  "name": "screen3d",
  "meta": { "title": "数智大屏", "requireAuth": false, "layout": false }
}
</route>
<script setup lang="tsx">
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import LayoutWrap from './components/LayoutWrap.vue';
import CenterBottom from './components/center-bottom/index.vue';
import Left from './components/left/index.vue';
import Right from './components/right/index.vue';
import CenterTop from './components/scene3/center-top/index.vue';
import customMap from './components/scene3/center-top/map.vue';

const route = useRoute();
const props = defineProps({
  isExpand: {
    type: Boolean,
    default: false,
  },
});

// 根据中间图缩放样式不同
const centerTopStyle = computed(() => {
  if (route.query.active !== '2') {
    return {
      margin: !props.isExpand ? '0 20px' : '0',
      width: !props.isExpand ? 'calc(100% - 40px)' : '100%',
      height: '100%',
      position: 'relative',
    };
  }
  return {};
});

const active = computed(() => {
  return +route.query.active || 0;
});
</script>
